package org.example.me.dao;

import org.example.me.model.Order;
import org.example.me.model.User;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 数据生成器工具类，用于生成模拟数据
 * 在实际应用中，这些方法应该被重写以从数据库获取真实数据
 */
public class DataGenerator {
    
    /**
     * 生成用户数据
     * 实际应用中应该从数据库查询真实数据
     * @return 用户列表
     */
    public static List<User> generateUserData() {
        List<User> userList = new ArrayList<>();
        
        User user1 = new User();
        user1.setId(1L);
        user1.setUsername("张三");
        user1.setEmail("zhangsan@example.com");
        user1.setCreateTime(new Date());
        userList.add(user1);
        
        User user2 = new User();
        user2.setId(2L);
        user2.setUsername("李四");
        user2.setEmail("lisi@example.com");
        user2.setCreateTime(new Date());
        userList.add(user2);
        
        User user3 = new User();
        user3.setId(3L);
        user3.setUsername("王五");
        user3.setEmail("wangwu@example.com");
        user3.setCreateTime(new Date());
        userList.add(user3);
        
        return userList;
    }
    
    /**
     * 生成订单数据
     * 实际应用中应该从数据库查询真实数据
     * @return 订单列表
     */
    public static List<Order> generateOrderData() {
        List<Order> orderList = new ArrayList<>();
        
        Order order1 = new Order();
        order1.setId(1L);
        order1.setOrderNo("ORD20251010001");
        order1.setUserId(1L);
        order1.setAmount(new BigDecimal("99.99"));
        order1.setOrderTime(new Date());
        orderList.add(order1);
        
        Order order2 = new Order();
        order2.setId(2L);
        order2.setOrderNo("ORD20251010002");
        order2.setUserId(2L);
        order2.setAmount(new BigDecimal("199.99"));
        order2.setOrderTime(new Date());
        orderList.add(order2);
        
        Order order3 = new Order();
        order3.setId(3L);
        order3.setOrderNo("ORD20251010003");
        order3.setUserId(3L);
        order3.setAmount(new BigDecimal("299.99"));
        order3.setOrderTime(new Date());
        orderList.add(order3);
        
        return orderList;
    }
}